<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html lang="en">
<head>
    <base href="${pageContext.request.contextPath}/">
    <meta charset="UTF-8">
    <title>四川工商学院失物招领系统</title>
    <%@include file="../common/commHeader.html"%>
</head>
<body style="background:#EEEEEE;">
<%@include file="header.jsp"%>
    <!--主题内容-->
    <div class="col-md-10 col-md-offset-1">
        <!--头部-->
        <div class="col-md-12">
            <img class="img-responsive" style="float: left" src="image/lost_found.png" alt="">
            <div class="header-info">
                <img class="img-responsive" src="image/timg.jpg"  alt="">
                <ol>
                    <p>四川工商学院失物招领平台最新动态：</p>
                    <li>共有<b>${infoList[0]}</b>条寻物启事，近三天有<b>${infoList[1]}</b>件物品遗失！</li>
                    <li>共<b>${infoList[2]}</b>条招领启事，近三天有<b>${infoList[3]}</b>件被捡物品！</li>
                    <li>共找回<b>${infoList[4]}</b>件失物！</li>
                    <li><b>注:该平台为免费信息交流平台，请各位师生文明交流！</b></li>
                </ol>
            </div>
            <div class="col-md-12 filtrate">
                <div class="top">
                    <span>筛选条件</span>
                </div>
                <div class="middle">
                    <div class="left">
                        <b>范围筛选</b>
                    </div>
                    <div class="right">
                        <ul>
                            <c:forEach var="item" items="${scopeList}">
                                <li><a href="notice/query0?scopeId=${item.scopeId}"  <c:if test="${item.scopeId eq Notice.scopeId}">style="color: red"</c:if>>${item.locName}</a></li>
                            </c:forEach>
                        </ul>
                    </div>
                </div>
                <hr>
                <div class="down">
                    <div class="left">
                        <b>快速筛选</b>
                    </div>
                    <div class="right">
                        <form id="myForm"  action="notice/query0" class="form-inline text-left" role="form" method="post" >
                            <input type="hidden" name="scopeId" id="scopeId" value="${Notice.scopeId}" />
                            <div class="col-md-12">
                                <div class="form-group laflostinput">
                                    <label class="control-label" for="cateId">类别</label>
                                    <select class="form-control" name="cateId" id="cateId">
                                        <option value="">-请选择-</option>
                                        <c:forEach var="item" items="${cateList}">
                                            <option  value="${item.cateId}" <c:if test="${item.cateId eq Notice.cateId}" >selected</c:if> >${item.cateName}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                                <div class="form-group laflostinput">
                                    <label class="control-label" for="lowTime">丢失时间</label>
                                    <input class="form-control" type="date" name="lowTime" value="<fmt:formatDate value="${Notice.lowTime}" pattern="yyyy-MM-dd" />"  id="lowTime">&nbsp;至
                                    <input class="form-control" type="date" name="hiTime" value="<fmt:formatDate value="${Notice.hiTime}" pattern="yyyy-MM-dd" />" id="hiTime">
                                </div>
                                <br><br>
                                <div class="form-group laflostinput">
                                    <label class="control-label" for="title">物品关键词</label>
                                    <input class="form-control" type="text" name="title" id="title" value="${Notice.title}" placeholder="请输入物品关键词">
                                </div>
                                <div class="form-group laflostinput">
                                    <label class="control-label" for="location">丢失地点</label>
                                    <input class="form-control" type="text" name="location" id="location" value="${Notice.location}" placeholder="请输入丢失地点">
                                </div>
                                <div class="form-group laflostinput">
                                    <button class="btn btn-info small" type="submit">筛选</button>
                                    <button class="btn  small" type="button" onclick="myReset()">清空</button>
                                </div>
                                <br><br>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="col-md-12 lafcontent">
                <div class="lafcard">
                    <!--卡片标题图片-->
                    <div align="center">
                        <img src="image/recent_lost.png" alt="">
                    </div>
                    <!--卡片效果-->
                    <ul>
                        <c:if test="${Page != null}">
                            <c:forEach var="item" items="${Page}">
                                <li>
                                    <a href="notice/detail${item.noticeId}">
                                        <c:if test="${fn:length(item.title)>12}">
                                            <p title="${item.title}">${fn:substring(item.title,0,12)}...</p>
                                        </c:if>
                                        <c:if test="${fn:length(item.title)<=12 and fn:length(item.title)!=0}">
                                            <p title="${item.title}">${item.title}</p>
                                        </c:if>
                                        <hr>
                                        <c:choose>
                                            <c:when test="${item.image1 != null and fn:length(fn:trim(item.image1))>0}">
                                                <img src="image/upload/${item.image1}"  alt="启事图片">
                                            </c:when>
                                            <c:when test="${item.image2 != null and fn:length(fn:trim(item.image2))>0}">
                                                <img src="image/upload/${item.image2}"  alt="启事图片">
                                            </c:when>
                                            <c:when test="${item.image3 != null and fn:length(fn:trim(item.image3))>0}">
                                                <img src="image/upload/${item.image3}"  alt="启事图片">
                                            </c:when>
                                            <c:otherwise>
                                                <img src="image/notImage.png" alt="启事图片" title="该启事暂无图片">
                                            </c:otherwise>
                                        </c:choose>
                                        <p><b><span>${item.scope.locName}</span>-<span>寻物启事</span></b></p>
                                        <c:if test="${fn:length(item.describe)>12}">
                                            <p title="${item.describe}">${fn:substring(item.describe,0,12)}...</p>
                                        </c:if>
                                        <c:if test="${fn:length(item.describe)<=12 and fn:length(item.describe)!=0}">
                                            <p title="${item.describe}">${item.describe}</p>
                                        </c:if>
                                        <c:if test="${fn:length(item.describe)==0}">
                                            <p title="启事发布人很懒，没有留下启事的描述信息">启事发布人很懒，没有留下...</p>
                                        </c:if>
                                        <p><fmt:formatDate value="${item.noticeTime}" pattern="yyyy-MM-dd" />发布</p>
                                    </a>
                                </li>
                            </c:forEach>
                        </c:if>
                        <c:if test="${Page.size() le 0 }">
                            <div style="width: 100%;text-align: center">
                                <img align="center" src="image/noData.png" alt="" />
                            </div>
                        </c:if>
                    </ul>
                </div>
            </div>
            <!--分页-->
            <div class="row">
                <div class="col-md-7 col-md-offset-5">
                    <div class="col-md-9">
                        <div class="dataTables_paginate paging_simple_numbers" style="margin-left: -15%">
                        <ul class="pagination">
                            <li class="paginate_button previous <c:if test="${Page.getPageNum() eq 1}">disabled</c:if>"  <c:if test="${Page.getPageNum() eq 1 }">onclick="return false"</c:if>>
                                <a href="notice/query0?pageNum=1">首页</a>
                            </li>
                            <li class="paginate_button <c:if test="${Page.getPageNum() eq 1}">disabled</c:if>"  <c:if test="${Page.getPageNum() eq 1}">onclick="return false"</c:if>>
                                <a href="notice/query0?pageNum=${Page.getPageNum()-1}">上一页</a>
                            </li>
                            <li class="paginate_button <c:if test="${Page.getPageNum() eq Page.getPages()}">disabled</c:if>"  <c:if test="${Page.getPageNum() eq Page.getPages()}">onclick="return false"</c:if>>
                                <a href="notice/query0?pageNum=${Page.getPageNum()+1}">下一页</a>
                            </li>
                            <li class="paginate_button nextdisabled  <c:if test="${Page.getPageNum() eq Page.getPages()}">disabled</c:if>"  <c:if test="${Page.getPageNum() eq Page.getPages()}">onclick="return false"</c:if>>
                                <a href="notice/query0?pageNum=${Page.getPages()}">末页</a>
                            </li>
                        </ul>
                    </div>
                    </div>
                    <div class="col-md-3">
                        <div class="dataTables_info" id="editable_info" role="status" aria-live="polite">第${Page.getPageNum()}页/共${Page.getPages()}页</div>
                    </div>
                </div>
            </div> <!--分页结束-->
            <div class="col-md-12 clearfix text-center">
                <div  class="laf-footer">
                    <p>成都校区：四川省成都市郫都区团结镇学院街65号 邮编：611745</p>
                    <p>眉山校区：眉山市眉州大道岷东段9号 邮编：620000</p>
                    <p>联系电话    招办：(028)87953080 校办:(028)87953896 人事处：(028)87953900 后勤处：(028)87953092</p>
                    <p>Email：yb@stbu.edu.cn</p>
                    <p> 四川工商学院信息网络中心 蜀ICP备05001554号</p>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function myReset(){
        $('#cateId').val('');
        $('#lowTime').val('');
        $('#hiTime').val('');
        $('#location').val('');
        $('#title').val('');
    }

    $(function () {
        $('#scpoeList a').click(function () {
            $('#scopeId').val($(this).attr('href').substr($(this).attr('href').indexOf('=')+1))
        })
    })
</script>
</body>
</html>